package de.gwtprime.shared.requestFactory.request;

import java.util.List;

import com.google.web.bindery.requestfactory.shared.InstanceRequest;
import com.google.web.bindery.requestfactory.shared.Request;
import com.google.web.bindery.requestfactory.shared.RequestContext;
import com.google.web.bindery.requestfactory.shared.Service;

import de.gwtprime.server.model.MyServiceLocator;
import de.gwtprime.server.model.Question;
import de.gwtprime.shared.requestFactory.AnswerProxy;
import de.gwtprime.shared.requestFactory.QuestionProxy;
import de.gwtprime.shared.requestFactory.User2Proxy;
import de.gwtprime.shared.requestFactory.VoteAnswerCompletedProxy;
import de.gwtprime.shared.requestFactory.VoteAnswerProxy;
import de.gwtprime.shared.requestFactory.VoteQuestionProxy;

@Service(value = Question.class, locator = MyServiceLocator.class)
public interface QuestionRequest extends RequestContext {

	Request<QuestionProxy> findQuestion(Long id);
	
	InstanceRequest<QuestionProxy, Long> persist();

	InstanceRequest<QuestionProxy, Void> remove();
	
	InstanceRequest<QuestionProxy, AnswerProxy> addAnswer(AnswerProxy section);
	
	InstanceRequest<QuestionProxy, List<VoteAnswerProxy>> getAllAnswerVotesForUser(User2Proxy user);
	
	InstanceRequest<QuestionProxy, List<VoteAnswerCompletedProxy>> getAllAnswerVotesCompleteForUser(User2Proxy user);
	
	InstanceRequest<QuestionProxy, VoteQuestionProxy> getVoteQuestionForUser(User2Proxy user);
	
	// Votes
	InstanceRequest<QuestionProxy, Void> addVoteAndPersist(VoteQuestionProxy section, User2Proxy user);
		
	Request<List<QuestionProxy>> getQuestionsForUser(String userName, int maxNumberResults);
}
